from gpiozero import Button
import os
from signal import pause

from warning import sendSupportAccept, sendSupportDeny, sendWarning

supportAcceptBtn = None
supportDenyBtn = None
warningBtn = None

def setBtnHandler(acceptHandler, denyHandler, warningHandler):
  global supportAcceptBtn
  global supportDenyBtn
  global warningBtn

  supportAcceptId = int(os.getenv('supportAcceptId'))
  supportDenyId = int(os.getenv('supportDenyId'))
  warningId = int(os.getenv('warningId'))

  print('supportAcceptId: {0}; supportDenyId: {1}; warningId: {2}'.format(supportAcceptId, supportDenyId, warningId))

  supportAcceptBtn = Button(supportAcceptId)
  supportDenyBtn = Button(supportDenyId)
  warningBtn = Button(warningId)

  print(warningBtn)
  supportAcceptBtn.when_pressed = acceptHandler
  supportDenyBtn.when_pressed = denyHandler
  warningBtn.when_pressed = warningHandler

